import axios from "axios"

//axios拦截器的封装  设置基准路由和错误处理
axios.interceptors.request.use(
        config => {
            config.baseURL = "/api"
            return config
        },
        err => {
            return Promise.reject(err)
        }
    )
    //响应拦截
axios.interceptors.response.use(
    res => {
        // console.log(res)
        return res.data
    },
    err => {
        console.log("我是拦截器中的err", err.response.data)
        return Promise.reject(err.response.data)
    }
)

export default axios